package demo1;

import java.util.Scanner;

public class Date2 {
    public static void rot(int[] num,int k){
        int n=num.length;
        k=k%num.length;
        reverse(num,0,n-1);
        reverse(num,0,k-1);
        reverse(num,k,n-1);
        for(int i=0;i<num.length;i++){
            System.out.print(num[i]);
        }
    }
    public static void reverse(int[] num,int s,int e){
        while(s<e){
            int a=num[s];
            num[s]=num[e];
            num[e]=a;
            s++;
            e--;
        }
    }

    public static void main(String[] args){

        Scanner in=new Scanner(System.in);
        int []num=new int[4];
        System.out.println("请输入数组元素：");
        for(int i=0;i<4;i++){
            num[i]=in.nextInt();
        }
        System.out.println("旋转数组请输入要旋转的轮数：");
        int c=in.nextInt();
        rot(num,c);

    }
}
